<template>
	<view class="">
		<view>
			<s-pull-scroll ref="pullScroll" :pullDown="pullDown" :pullUp="loadData" :back-top="true">
				<view class="mes-con">
					<view class="item" @tap="navTo(`/pages/public/noticedetails?id=${item.id}&title=${item.title}`)" v-for="(item, index) in dataList" :key="index">
						<view class="item-title clamp">{{ item.title }}</view>
						<view class="item-txt clamp">{{ item.createDate }}</view>
					</view>
				</view>
			</s-pull-scroll>
		</view>
		<mix-loading v-if="isLoading"></mix-loading>
	</view>
</template>

<script>
export default {
	data() {
		return {
			dataList: []
		};
	},
	onLoad() {
		this.refresh();
	},
	methods: {
		pullDown(pullScroll) {
			setTimeout(() => {
				this.loadData(pullScroll);
			}, 200);
		},
		async loadData(pullScroll) {
			const data = {
				uid: uni.getStorageSync('uid'),
				pageNo: pullScroll.page,
				pageSize: '10'
			};
			const res = await this.$request('user/sys-msg-list', data, { showLoading: true });
			if (pullScroll.page == 1) this.dataList = [];
			if (res.result == 0) {
				this.dataList = this.dataList.concat(res.data.list);
				pullScroll.endByPage(Math.ceil(res.data.count / 10), res.data.list);
			} else {
				this.$util.msg(res.resultNote);
			}
		}
	}
};
</script>
<style scoped lang="scss">
.mes-con {
	margin: 0 auto;
	padding: 20rpx;
}
.item {
	padding: 40upx 20rpx;
	margin-bottom: 20upx;
	background: #f6f6f6;
	border-radius: 10upx;
}
.item:last-child {
	border-bottom: none;
}
.item-left-icon {
	position: relative;
	width: 76rpx;
	height: 76rpx;
	margin-right: 20rpx;
}
.left-icon {
	width: 76rpx;
	height: 76rpx;
}
.isRead {
	position: absolute;
	top: 0;
	right: 6rpx;
	width: 14rpx;
	height: 14rpx;
	background: #ff5656;
	border-radius: 50%;
}
.item-title {
	font-size: 28upx;
	font-weight: bold;
	color: #333333;
	line-height: 44upx;
}
.item-txt {
	font-size: 24upx;
	color: #838383;
	line-height: 44upx;
}
.item-right {
	font-size: 24rpx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #999999;
}
</style>
